package com.gluck.cases.core.modal.assemble;



import com.gluck.cases.core.modal.dto.PermissionListDTO;
import com.gluck.cases.core.modal.entity.Permission;

import java.util.List;
import java.util.stream.Collectors;

/**
 * @ClassName PermissionAssemble
 * @Desc PermissionAssemble 包装类
 * @Author I am Gluck
 * @Date 2022/5/21 - 12:26 上午
 **/
public class PermissionAssemble {

    public static List<PermissionListDTO> PermissionConvertDtoList(List<Permission> permission){
        List<PermissionListDTO> result = permission.stream().map((entity) -> {
            PermissionListDTO dto = new PermissionListDTO();
            dto.setCategory(entity.getCategory());
            dto.setCreatedBy(entity.getCreatedBy());
            dto.setId(entity.getId());
            dto.setName(entity.getName());
            dto.setPerCode(entity.getPerCode());
            dto.setRemark(entity.getRemark());
            dto.setUrl(entity.getUrl());
            dto.setParentId(entity.getParentId());
            return dto;
        }).collect(Collectors.toList());
        return result;
    }
}
